package com.pgytesting.secondhandcar.service.impl;

import com.pgytesting.secondhandcar.dao.CreditBureauBlackLibraryDao;
import com.pgytesting.secondhandcar.model.CreditBureauBlackLibrary;
import com.pgytesting.secondhandcar.service.CreditBureauBlackLibraryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 征信黑库(CreditBureauBlackLibrary)表服务实现类
 *
 * @author makejava
 * @since 2019-08-12 18:55:58
 */
@Service("creditBureauBlackLibraryService")
public class CreditBureauBlackLibraryServiceImpl implements CreditBureauBlackLibraryService {
    @Resource
    private CreditBureauBlackLibraryDao creditBureauBlackLibraryDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CreditBureauBlackLibrary queryById(Integer id) {
        return this.creditBureauBlackLibraryDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<CreditBureauBlackLibrary> queryAllByLimit(int offset, int limit) {
        return this.creditBureauBlackLibraryDao.queryAllByLimit(offset, limit);
    }
    
    /**
     * 条件查询多条数据
     *
     * @param creditBureauBlackLibrary 实例对象
     * @return 对象列表
     */
    @Override
    public List<CreditBureauBlackLibrary> queryAll(CreditBureauBlackLibrary creditBureauBlackLibrary) {
        return this.creditBureauBlackLibraryDao.queryAll(creditBureauBlackLibrary);
    }

    /**
     * 新增数据
     *
     * @param creditBureauBlackLibrary 实例对象
     * @return 实例对象
     */
    @Override
    public CreditBureauBlackLibrary insert(CreditBureauBlackLibrary creditBureauBlackLibrary) {
        this.creditBureauBlackLibraryDao.insert(creditBureauBlackLibrary);
        return creditBureauBlackLibrary;
    }

    /**
     * 修改数据
     *
     * @param creditBureauBlackLibrary 实例对象
     * @return 实例对象
     */
    @Override
    public CreditBureauBlackLibrary update(CreditBureauBlackLibrary creditBureauBlackLibrary) {
        this.creditBureauBlackLibraryDao.update(creditBureauBlackLibrary);
        return this.queryById(creditBureauBlackLibrary.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.creditBureauBlackLibraryDao.deleteById(id) > 0;
    }
}